package bulid;

/**
 * @author aiowang
 * @description:
 * @date 2020/9/10 21:20
 */
public class ThreadExtendsTest {
    public static void main(String[] args) throws Exception {
        testExtends();
    }

    private static void testExtends() throws Exception{
        Thread t1 = new ThreadExtends();
        Thread t2 = new ThreadExtends();
        t1.start();
        t2.start();
    }
}


class ThreadExtends extends Thread{

    @Override
    public void run() {
        System.out.println("通过继承Thread类，线程号：" + currentThread().getName());
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("通过继承Thread类，线程号：" + currentThread().getName());
    }


}